import com.vic.test.com.vic.entity.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

public class test {
    public static void main(String[] args) {
        try {
            InputStream inputStream = Resources.getResourceAsStream("mapper/mybatis-config.xml");
            SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);

            SqlSession session =   sessionFactory.openSession();

            User user = new User(1,"lil","12");

            session.insert("com.vic.dao.UserMapper.save",user);

            session.commit();
            session.clearCache();

        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
